<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>年会抽奖</title>
    <style>
        .wrapper {
            width: 840px;
            height: 420px;
            background: url(./images/bg01.jpg) no-repeat center / cover;
            padding: 100px 250px;
            box-sizing: border-box;
        }

        .wrapper span {
            color: #b10e0d;
        }
    </style>
</head>

<body>
    <div class="wrapper">
        <strong>年会抽奖</strong>
        <h1>一等奖：<span class="one">???</span></h1>
        <h3>二等奖：<span class="two">???</span></h3>
        <h5>三等奖：<span class="three">???</span></h5>
    </div>

    <script>
        const arr = ['颜建', '喻锐', '张俊鹏', '李程程', '陈岳山', '陈盛熙']
        // 获取页面中设置类名的 span 元素
        let spans = document.querySelectorAll('.one, .two, .three')
        // console.log(spans)
        for (let i = 0; i < 3; i++) {
            let index = Math.floor(Math.random() * (arr.length - 1 - 0 + 1)) - 0
            // console.log(arr[index])
            // 每次循环 把数组中的随机出来的数据 赋值给 span标签内
            spans[i].innerText = arr[index]
            // 出现一次 然后从数组中删除这个数据
            arr.splice(index, 1)
        }
    </script>
</body>

</html>